import { httpForm } from "@/request/http";
// 网络请求demo 列子

// 获取当前项目信息
// export const getCurrentProjectInfo = {
//     url: "projectInfoApp/getCurrentProjectInfo",
//     method: "get",
//     isLoading: true
// }

const getCurrentProjectInfo = (params) => {
    return httpForm({
        url: "projectInfoApp/getCurrentProjectInfo",
        method: "post",
        isLoading: true
    }, params)
};

//注册用户（有资金密码，需要填写邮箱或手机验证码）,只适用于手机和邮箱注册
const registerEmailPhone = (params) => {
    return httpForm({
        url: "/api/localuser!register.action",
        method: "post",
        isLoading: true
    }, params)
};


//注册用户（有资金密码）,只适用于用户名注册
const registerAccount = (params) => {
    return httpForm({
        url: "/api/localuser!register_username.action",
        method: "post",
        isLoading: true
    }, params)
};


//注册用户（无资金密码），适用于用户名，邮箱，手机注册,注册接口不需要填写邮箱或手机验证码，在下一个页面验证验证码
const registerUser = (params) => {
    return httpForm({
        url: "/api/localuser!registerNoVerifcode.action",
        method: "post",
        isLoading: true
    }, params)
};
//登录
const loginUser = (params) => {
    return httpForm({
        url: "/api/user!login.action",
        method: "post",
        isLoading: true
    }, params)
};

//谷歌手机邮箱验证登录，和原登录接口传参一样，返回结果token为空需跳到验证码输入界面
const googleLogin = (params) => {
    return httpForm({
        url: "/api/user!googleLogin.action",
        method: "post",
        isLoading: true
    }, params)
};

// 验证码验证登录
const verifCodeLogin = (params) => {
    return httpForm({
        url: "/api/user!verifCodeLogin.action",
        method: "post",
        isLoading: true
    }, params)
};

/// 发送邮箱 手机验证码
const sendVerifyCode = (params) => {
    return httpForm({
        url: "/api/idcode!execute.action",
        method: "post",
        isLoading: false
    }, params)
};

/// 帮助中心
const helpCenter = (params) => {
    return httpForm({
        url: "/api/cms!list.action",
        method: "post",
        isLoading: false
    }, params)
};

//试用注册登录
const registerTest = (params) => {
    return httpForm({
        url: "/api/localuser!registerTest.action",
        method: "post",
        isLoading: true
    }, params)
};

//账户登出
const loginOut = (params) => {
    return httpForm({
        url: "/api/user!logout.action",
        method: "post",
        isLoading: true
    }, params)
};
//发送手机通讯录
const addAddressBook = (params) => {
    return httpForm({
        url: "/api/user!addAddressBook.action",
        method: "post",
        isLoading: false
    }, params)
};

const apiList = {
    getCurrentProjectInfo, registerUser, sendVerifyCode, loginUser, helpCenter, registerTest,googleLogin,verifCodeLogin,loginOut,registerEmailPhone,registerAccount,addAddressBook
}

export default apiList
